Any operations permitted on type Addr64_ other than assignment?

It seems a new type exists, namely Addr64_.

Other than being a 64-bit storage cell, can any operations be performed?

It appears that it can't be incremented ++ (64 bit arithmetic is not supported). 

You can't add offsets (e.g., addr64 = addr64 + 8;).

I think I found a hack to do offsets (which I'll share after I clean it up), but a type without any operations isn't very useful or fun.


Fu Lin Yiu - Wed Aug 02 21:12:32 EDT 2017

Re: Any operations permitted on type Addr64_ other than assignment?
Fu Lin Yiu - Wed Aug 02 21:31:48 EDT 2017

Here is a way to be able to add offsets to Addr64_ (it is a start anyway).  Is anything known to be forthcoming? 

I expect stuff like "++", "--", "+=", and "-=" to come out of the box.

// _Addr64Test
/*
  _Addr64Test
*/

void debugLog(string msg) {
    print(msg "\n");
}

Addr64_ addressOfVar(_m& anyVar) {
    Addr64_ temp = (Addr64_ (addr_ anyVar));
    return temp;
}

int internalIntContentOfAddress(int& refToInt) {
    int content = refToInt;
    return content;
}

int intContentOfAddress(Addr64_ addr64) {
    return (internalIntContentOfAddress(addr_ addr64));
}

//------------------------------------------------------------------------------
// Provide a way to add an offset to an Addr64_ memory reference var
//------------------------------------------------------------------------------
void ::+=(Addr64_& addr64, int offset) {
    Addr64_ localAddr64 = addr64;

    //--------------------------------------------------------------------------
    // Since this is a pointer, I'm assuming it is what it is (64-bits here).
    //--------------------------------------------------------------------------
    int* pointerToInt = (addr_ localAddr64);
    pointerToInt += offset; // Operator += is allowed here
    addr64 = (Addr64_ addr_ pointerToInt);
}

void main() {
    int a = 123;
    int b = 456;
    debugLog("a = " a "");
    debugLog("b = " b "");
    debugLog("a* = " addressOfVar(a) "");
    debugLog("b* = " addressOfVar(b) "");
    Addr64_ addr64 = addressOfVar(a);
    debugLog("Initial addr64 = " addr64 "");
    debugLog("Initial content of addr64 = " intContentOfAddress(addr64) "");
    addr64 += 8; // User-defined overload of += (Why can't IBM give this?)
    debugLog("subsequent addr64 = " addr64 "");
    debugLog("New content of addr64 = " intContentOfAddress(addr64) "");
}

main();

Here is the output:

a = 123
b = 456
a* = 117166632
b* = 117166640
Initial addr64 = 117166632
Initial content of addr64 = 123
subsequent addr64 = 117166640
New content of addr64 = 456